package com.qust.rest.configs;

import com.qust.rest.interceptor.AuthInterceptor;
import com.qust.securityapi.service.CheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author Frank KONG
 * @version 1.0
 * @date 2021/11/22 20:08
 */
@Configuration
public class webConfig implements WebMvcConfigurer {

    @Autowired
    private CheckService checkService;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new AuthInterceptor(checkService))
                .addPathPatterns("/test/**");
    }
}
